import socket from "./index";

interface IUserInfo {
    uUid: string;
    uNickName: string;
    uEmail: string;
    uPwd: string;
}

export interface ISignUp {
    code: number;
    msg: string;
}

const signUp = (userInfo: IUserInfo) => {
    return new Promise((resolve,reject) => {
        socket.emit('signUp',userInfo)
        socket.on('signUp',(answer: ISignUp) => {
            if(answer.code === 200 || answer.code === 201){
                resolve(answer)
            }else {
                reject(answer.msg)
            }
        })
    })
}

export default signUp
